import { faker } from "@faker-js/faker";
import type { KnowledgeItem } from "@/api/services/knowledge";

const generateMockKnowledge = (): KnowledgeItem => ({
	id: faker.number.int(),
	title: faker.lorem.sentence(),
	content: faker.lorem.paragraphs(),
	author: faker.person.fullName(),
	tags: Array.from({ length: faker.number.int({ min: 1, max: 4 }) }, () =>
		faker.helpers.arrayElement([
			"技术",
			"营销",
			"管理",
			"设计",
			"产品",
			"运营",
			"数据",
			"AI",
		]),
	),
	views: faker.number.int({ min: 100, max: 10000 }),
	likes: faker.number.int({ min: 10, max: 1000 }),
	createTime: faker.date.recent({ days: 30 }).toISOString(),
});

export const mockKnowledgeList = Array.from(
	{ length: 50 },
	generateMockKnowledge,
);
